/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.ipti.br.tag.util;

import java.io.IOException;
import java.util.logging.*;

/**
 *
 * @author ipti
 */
public class LoggerUtil {
    
    private static FileHandler fileTxt;
    private static SimpleFormatter txtFormater;
    
    static{
        try {
            fileTxt = new FileHandler("Logging.txt");
            txtFormater = new SimpleFormatter();
            fileTxt.setFormatter(txtFormater);
            Logger logger = Logger.getLogger("");
            logger.addHandler(fileTxt);
            logger.setLevel(Level.INFO);
        } catch (Exception ex) {
            System.out.println("Não inicializou o Logger");
        }
    }
    
    public static void log(String name, Level level, String msg){
        log(name, level,msg,null);
    }
    
    public static void log(String name, Level level, String msg, Exception ex){
        Logger.getLogger(name).log(level, msg, ex);
    }
}
